﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;

namespace DAO
{
    public partial class LoaiVe_DAO
    {

        /// Thêm mới một nhan viên
        /// </summary>
        /// <param name="nhanvien"></param>
        /// <returns></returns>
        public bool ThemLoaiVe(LoaiVe loaive_dto)
        {
            DataProvider dp = new DataProvider();
            SqlParameter[] Parameter = new SqlParameter[3];
            Parameter[0] = new SqlParameter("@TenLoaiVe", loaive_dto.TenLoaiVe);
            Parameter[1] = new SqlParameter("@Gia", loaive_dto.Gia);
            Parameter[2] = new SqlParameter("@isdelete ", loaive_dto.IsDelete);
            return dp.ExecutenonQuery("sp_ThemLoaiVe", Parameter);
        }
        public bool SuaLoaiVe(LoaiVe loaive_dto)
        {
            DataProvider dp = new DataProvider();
            SqlParameter[] Parameter = new SqlParameter[3];
            Parameter[0] = new SqlParameter("@MaLoaiVe", loaive_dto.MaLoaiVe);
            Parameter[1] = new SqlParameter("@TenLoaiVe", loaive_dto.TenLoaiVe);
            Parameter[2] = new SqlParameter("@Gia", loaive_dto.Gia);
            return dp.ExecutenonQuery("sp_SuaLoaiVe", Parameter);
        }

        public bool XoaLoaiVe(string MaLoaiVe)
        {
            DataProvider dp = new DataProvider();
            SqlParameter[] Parameter = new SqlParameter[1];
            Parameter[0] = new SqlParameter("@MaLoaiVe",MaLoaiVe);
            return dp.ExecutenonQuery("sp_XoaLoaiVe", Parameter);
        }

        public DataTable DanhSachLoaiVe()
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();
            dt = dp.ExecuteQuery("sp_DanhSachLoaiVe");
            return dt;
        }

        public DataTable DanhSachLoaiVe_Ma(string strMa)
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();
            SqlParameter[] Parameter = new SqlParameter[1];

            Parameter[0] = new SqlParameter("@MaLoaiVe", strMa);
            dt = dp.ExecuteQuery("sp_DanhSachLoaiVeTheoMa", Parameter);
            return dt;
        }

        public DataTable getGiaVeNguoiLon(string strBuoi, string strNgay)
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();
            SqlParameter[] Parameter = new SqlParameter[2];
            Parameter[0] = new SqlParameter("@buoi", strBuoi);
            Parameter[1] = new SqlParameter("@ngay", strNgay);
            dt = dp.ExecuteQuery("sp_getGiaVeNguoiLon", Parameter);
            return dt;
        }
    }
}
